<template>
    <input type="text" v-model="val">
    <button @click="handleAdd">点击提交</button>
</template>
<script setup>
import {ref,defineEmits} from "vue"
// 子传父
let val = ref("")
let emit = defineEmits(['add'])
let handleAdd=()=>{
    console.log(val.value)//得到input输入的值
    emit('add',val.value)
}
</script>